home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ODInit.cpp
-
- Contains: CFM Init routine for the OpenDoc shared library
-
- Owned by: Jens Alfke
-
- Copyright: © 1995 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <2> 5/24/96 jpa 1246074: Call CW init/terminate routines:
- needed for native exception support.
- <2> 9/29/95 TJ Made Changes for MAC SOM
- <1> 8/11/95 jpa first checked in
-
- To Do:
- In Progress:
-
- */
-
-
- #ifndef __USERSRCM__
- #include <UseRsrcM.h>
- #endif
-
- #ifndef _ODMEMORY_
- #include <ODMemory.h>
- #endif
-
- #ifdef __MWERKS__
- extern "C" {
- void __initialize(); // From Metrowerks runtime library, Startup.c
- void __terminate();
- }
- #endif
-
-
- extern void BentoInit ( ); // BentoInit.cpp
- extern OSErr ImagingInit(); // ImagingInit.cpp
- extern OSErr LayoutInit(); // LayoInit.cpp
-
-
- extern "C" pascal OSErr OpenDocCFMInit( CFragInitBlockPtr );
- extern "C" pascal void OpenDocCFMTerminate( );
-
- pascal OSErr OpenDocCFMInit (CFragInitBlockPtr initBlkPtr)
- {
- #ifdef __MWERKS__
- __initialize(); // Initialize static data and construct any global objects
- #endif
-
- OSErr err;
-
- // Initialize our resource fork for later access:
- if( (err= InitLibraryResources(initBlkPtr)) != noErr ) return err;
-
- // Initialize ODMemory utility:
- if( (err= InitODMemory()) != noErr ) return err;
-
- // Initialize Bento subsystem:
- BentoInit ();
-
- // Initialize Imaging subsystem:
- if( (err= ImagingInit()) != noErr ) return err;
-
- // Initialize Layout subsystem:
- if( (err= LayoutInit()) != noErr ) return err;
-
- return noErr;
- }
-
- pascal void OpenDocCFMTerminate( )
- {
- CloseLibraryResources();
- #ifdef __MWERKS__
- __terminate(); // Destruct static objects & clean up exception tables
- #endif
- }
-